package com.eve.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by hduprince on 16/7/5.
 */
public class ValidateUtil {

    private static final Logger logger = LoggerFactory.getLogger(ValidateUtil.class);

    private final static String MOBILE_NUMBER_PATTERN = "^1[3,4,5,7,8]{1}[0-9]{9}$";

    public static boolean isValidMobileNo(String mobileNo) {

        boolean isValid = false;

        try {
            Pattern p=Pattern.compile(MOBILE_NUMBER_PATTERN);
            Matcher m=p.matcher(mobileNo);
            isValid = m.matches();
            return isValid;

        } catch (Exception e) {
            logger.error("Exception Occurred for: " + mobileNo);
        }
        return isValid;
    }
}
